<header class="navbar navbar-static-top bs-docs-nav" id="top">
    <div class="container">
        <div class="navbar-header">
            <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#bs-navbar"
                    aria-controls="bs-navbar" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar" style="background-color:#fff;"></span>
                <span class="icon-bar" style="background-color:#fff;"></span>
                <span class="icon-bar" style="background-color:#fff;"></span>
            </button>
            <a href="/" class="navbar-brand" style="color:#fff;">
                <b style="font-style: italic">
                    <b style="color:#86ADD4;">
                        DSPSTACK
                    </b>
                    .COM
                </b>
            </a>
        </div>
        <nav id="bs-navbar" class="collapse navbar-collapse " aria-expanded="true">
            <ul class="nav navbar-nav navbar-left" id="nav_list">
                <li class="{{ (Request::is('topics') && ! Request::is('categories*') ? ' active' : '') }}">
                    <a style="background:none;" href="{{ route('topics.index') }}">{{ lang('Topics') }}</a>
                </li>
                <li >
                    <a style="background:none;" href="{{ route('categories.show', config('phphub.basic_math_id')) }}">
                        {{ lang('Basic Math') }}
                    </a>
                </li>

                <li class="{{ (Request::is('topics') && ! Request::is('categories*') ? ' active' : '') }}">
                    <a style="background:none;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                       id="dLabel" href="javascript:void(0);">
                        信号处理
                        <span class="caret"></span>
                        <ul class="dropdown-menu" aria-labelledby="dLabel">
                            <li >
                                <a href="{{ route('categories.show', config('phphub.basic_theory_id')) }}">
                                    {{ lang('Basic Theory') }}
                                </a>
                            </li>
                            <li>
                                <a href="{{ route('categories.show', config('phphub.speech_application_id')) }}">
                                    {{ lang('Speech Signal Processing') }}
                                </a>
                            </li>
                            <li>
                                <a class="button no-pjax"
                                   href="{{ route('categories.show', config('phphub.image_application_id')) }}">
                                    {{ lang('Image Processing')  }}
                                </a>
                            </li>
                            <li>
                                <a class="button no-pjax"
                                   href="{{ route('categories.show', config('phphub.earthquake_application_id')) }}">
                                    {{ lang('Earth Quake Processing')  }}
                                </a>
                            </li>

                        </ul>

                    </a>

                </li>
                {{--<li class="{{ (Request::is('categories/'.config('phphub.ai_category_id')) || (isset($topic) && $topic->category_id == config('phphub.ai_category_id'))) ? ' active' : '' }}">--}}
                    {{--<a style="background:none;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"--}}
                       {{--id="dLabel" href="javascript:void(0);">--}}
                        {{--人工智能--}}

                        {{--<span class="caret"></span>--}}
                        {{--<ul class="dropdown-menu" aria-labelledby="dLabel">--}}
                            {{--<li>--}}
                                {{--<a href="{{ route('categories.show', config('phphub.ai_category_id')) }}">人工智能</a>--}}
                            {{--</li>--}}

                            {{--<li>--}}
                                {{--<a class="button no-pjax"--}}
                                   {{--href="{{ route('categories.show', config('phphub.ml_category_id')) }}">--}}
                                    {{--机器学习--}}
                                {{--</a>--}}
                            {{--</li>--}}
                        {{--</ul>--}}
                    {{--</a>--}}
                {{--</li>--}}
                {{--<li>--}}
                    {{--<a style="background:none;"  href="{{ route('categories.show', config('phphub.big_data_id')) }}">大数据</a>--}}
                {{--</li>--}}
                <li>
                    <a style="background:none;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                       id="dLabel" href="javascript:void(0);">
                        算法工具

                        <span class="caret"></span>
                        <ul class="dropdown-menu" aria-labelledby="dLabel">
                            <li>
                                <a class="button no-pjax"
                                   href="{{ route('categories.show', config('phphub.matlab_algorithm_id')) }}">
                                    {{ lang('Matlab Algorithm') }}
                                </a>
                            </li>
                            <li>
                                <a href="{{ route('categories.show', config('phphub.python_algorithm_id')) }}">{{ lang('Python Algorithm') }}</a>
                            </li>

                            <li class="{{ (Request::is('categories/'.config('phphub.algorithm_sdk_id')) || (isset($topic) && $topic->category_id == config('phphub.algorithm_sdk_id'))) ? ' active' : '' }}">
                                <a href="{{ route('categories.show', config('phphub.algorithm_sdk_id')) }}">{{ lang('Algorithm SDK') }}</a>
                            </li>
                        </ul>
                    </a>
                </li>

                <li>
                    <a style="background:none;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                       id="dLabel" href="javascript:void(0);">
                        资源

                        <span class="caret"></span>
                        <ul class="dropdown-menu" aria-labelledby="dLabel">
                            <li>
                                <a class="button no-pjax"
                                   href="{{ route('categories.show', config('phphub.resources_id')) }}">
                                    {{ lang('Resources') }}
                                </a>
                            </li>
                            <li>
                                <a href="{{ route('categories.show', config('phphub.algorithm_sources_id')) }}">算法源码</a>
                            </li>
                            <li>
                                <a href="{{ route('categories.show', config('phphub.rc_help_id')) }}">资源求助</a>
                            </li>

                        </ul>
                    </a>
                </li>

                <li>
                    <a style="background:none;" href="{{ route('categories.show', config('phphub.translate_id')) }}">翻译</a>
                </li>
                @if (Auth::check())
                    {{--<li>--}}
                        {{--<a style="background:none;"--}}
                           {{--href="{{ route('categories.show', config('phphub.homework_help_id')) }}">{{ lang('Homework Help') }}</a>--}}
                    {{--</li>--}}
                    <li>
                        <a style="background:none;" href="{{ route('categories.show', config('phphub.hunt_category_id')) }}">分享链接</a>
                    </li>

                    <li>
                        <a data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="dLabel"
                           style="background:none;"
                           href="{{ route('categories.show', config('phphub.python_algorithm_id')) }}">
                            更多
                            <span class="caret"></span>

                            <ul class="dropdown-menu" aria-labelledby="dLabel">
                                <li>
                                    <a href="{{ route('categories.show', config('phphub.jobs_id')) }}">{{ lang('Jobs') }}</a>
                                </li>
                                {{--<li>--}}
                                    {{--<a href="{{ route('categories.show', config('phphub.homework_help_id')) }}">{{ lang('Homework Help') }}</a>--}}
                                {{--</li>--}}

                                {{--<li>--}}
                                    {{--<a href="{{ route('categories.show', config('phphub.hunt_category_id')) }}">分享链接</a>--}}
                                {{--</li>--}}
                                <li>
                                    <a href="{{ route('categories.show', config('phphub.blog_category_id')) }}">{{ lang('Blog') }}</a>
                                </li>
                                <li>
                                    <a href="{{ route('categories.show', config('phphub.phd_family_id')) }}">硕博家园</a>
                                </li>

                                <li>
                                    <a href="{{ route('sites.sponsor') }}">{{ lang('Sponsor') }}本站</a>
                                </li>
                            </ul>
                        </a>
                    </li>
                @else
                    <li>
                        <a style="background:none;"
                           href="{{ route('categories.show', config('phphub.jobs_id')) }}">{{ lang('Jobs') }}</a>
                    </li>
                    {{--<li>--}}
                        {{--<a style="background:none;"--}}
                           {{--href="{{ route('categories.show', config('phphub.homework_help_id')) }}">{{ lang('Homework Help') }}</a>--}}
                    {{--</li>--}}
                    <li>
                        <a style="background:none;" href="{{ route('categories.show', config('phphub.hunt_category_id')) }}">分享链接</a>
                    </li>
                    <li>
                        <a style="background:none;" href="{{ route('categories.show', config('phphub.blog_category_id')) }}">{{ lang('Blog') }}</a>
                    </li>

                    <li>
                        <a style="background:none;" href="{{ route('categories.show', config('phphub.phd_family_id')) }}">硕博家园</a>
                    </li>

                    {{--<li>--}}
                        {{--<a style="background:none;"--}}
                           {{--href="{{ route('sites.sponsor') }}">{{ lang('Sponsor') }}本站</a>--}}
                    {{--</li>--}}
                    {{--<li>--}}
                        {{--<a style="background:none;" href="{{ route('categories.show', config('phphub.translate_id')) }}">外文翻译</a>--}}
                    {{--</li>--}}
                @endif
            </ul>


            <ul class="nav navbar-nav navbar-right">
                <li id="search_content" style="display:none;">
                    @if ((Request::is('users*') && isset($user)) || (Request::is('search*') && $user->id > 0))
                        <form method="GET" action="{{ route('search') }}" accept-charset="UTF-8"
                              class="navbar-form navbar-left">
                            <div class="form-group">
                                <input class="form-control search_input" placeholder="搜索范围：{{ $user->name }}" name="q"
                                       type="text"
                                       value="{{ (Request::is('search*') && isset($query)) ? $query : '' }}">
                                <input class="form-control search_input" name="user_id" type="hidden"
                                       value="{{ $user->id }}">

                                @else
                                    <form method="GET" action="{{ route('search') }}" accept-charset="UTF-8"
                                          class="navbar-form navbar-left">
                                        <div class="form-group">
                                            <input class="form-control search_input" placeholder="搜索" name="q"
                                                   type="text"
                                                   value="{{ (Request::is('search*') && isset($query)) ? $query : '' }}">

                                            @endif
                                        </div>
                                    </form>

                </li>
                <li>
                    <a style="background:none;" href="javascript:void(0)">

                        <i class="fa fa-search" onclick="toggle_search(1)"></i>
                        <i class="fa fa-close" style="display:none;" onclick="toggle_search(2)"></i>
                    </a>

                </li>
            </ul>

            @if (Auth::check())
                <ul class="nav navbar-nav navbar-right" id="content">
                    <li>
                        <a href="#" type="button" data-toggle="dropdown" style="background: none;" aria-haspopup="true"
                           aria-expanded="false">
                            <i class="fa fa-plus text-md"></i>
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="dLabel">
                            <li>
                                <a class="button no-pjax"
                                   href="{{ URL::route('topics.create', ['category_id' => config('phphub.resources_id')]) }}">
                                    <i class="fa fa-upload text-md"></i> 上传资源
                                </a>
                            </li>

                            <li>
                                <a class="button no-pjax" href="{{ route('articles.create') }}">
                                    <i class="fa fa-paint-brush text-md"></i> 创作文章
                                </a>
                            </li>

                            <li>
                                <a class="button no-pjax" href="{{  URL::route('topics.create') }}">
                                    <i class="fa fa-comment text-md"></i> 发起讨论
                                </a>
                            </li>
                            <li>
                                <a class="button no-pjax" href="{{ route('share_links.create', ['category_id' => config('phphub.hunt_category_id')]) }}">
                                    <i class="fa fa-link text-md"></i> 分享链接
                                </a>
                            </li>
                            <li>
                                <a class="button no-pjax"
                                   href="{{ URL::route('topics.create', ['category_id' => config('phphub.homework_help_id')]) }}">
                                    <i class="fa fa-question-circle text-md"></i> 提个问题
                                </a>
                            </li>
                            @if (Auth::user()->can('manage_topics'))
                            <li>
                                <a class="button no-pjax" href="{{ route('admin-translate.index')}}">
                                    <i class="fa fa-language text-md"></i> 操作翻译
                                </a>
                            </li>
                            @endif
                        </ul>
                    </li>
                    <li>
                        <a href="#" style="background: none;" data-toggle="dropdown" aria-haspopup="true"
                           aria-expanded="false" id="dLabel">
                            <img class="avatar-topnav" alt="Summer" src="{{ $currentUser->present()->gravatar }}"/>
                            <span class="login-name">{{ mb_substr($currentUser->name, 0,5) }}</span>
                            <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" aria-labelledby="dLabel">
                            @if (Auth::user()->can('visit_admin'))
                                <li>
                                    <a href="/{{config('administrator.uri')}}" class="no-pjax">
                                        <i class="fa fa-tachometer text-md"></i> 管理后台
                                    </a>
                                </li>
                            @endif

                            @if(Auth::user()->can('access_board'))
                                <li>
                                    <a class="button"
                                       href="{{ route('categories.show', config('phphub.admin_board_cid')) }}">
                                        <i class="fa fa-users "></i> 站务
                                    </a>
                                </li>
                            @endif
                            <li>
                                <a class="button"
                                   href="{{ isset($currentUser->blog) ? route('blogs.show', $currentUser->blog->slug) : route('blogs.create') }}">
                                    <i class="fa fa-hacker-news text-md"></i> 我的博客
                                </a>
                            </li>
                            <li>
                                <a class="button" href="{{ route('users.votes', $currentUser->id) }}">
                                    <i class="fa fa-heart text-md"></i> 我的收藏
                                </a>
                            </li>
                            <li>
                                <a class="button" href="{{ route('users.show', $currentUser->id) }}">
                                    <i class="fa fa-user text-md"></i> 个人中心
                                </a>
                            </li>
                            <li>
                                <a class="button" href="{{ route('users.charge_dcoin', $currentUser->id) }}">
                                    <i class="fa fa-credit-card text-md"></i> 充D币
                                </a>
                            </li>
                            <li>
                                <a class="button" href="{{ route('users.edit', $currentUser->id) }}">
                                    <i class="fa fa-cog text-md"></i> 编辑资料
                                </a>
                            </li>
                            <li>
                                <a id="login-out" class="button" href="{{ URL::route('logout') }}"
                                   data-lang-loginout="{{lang('Are you sure want to logout?')}}">
                                    <i class="fa fa-sign-out text-md"></i> 退出
                                </a>
                            </li>
                        </ul>
                    </li>

                    <li>
                        <a style="background:none;" href="{{ route('notifications.unread') }}">
                      <span class="badge badge-{{ $currentUser->notification_count + $currentUser->message_count > 0 ? 'important' : 'fade' }} popover-with-html"
                            data-content="消息提醒" id="notification-count">
                      {{ $currentUser->notification_count + $currentUser->message_count }}
                      </span>
                        </a>
                    </li>

                    <li>
                        <a class="sign-btn" style="background:none;" href="javascript:void(0)">
                            <i class="fa fa-user"></i>
                            {{$signStatus != 0 ? lang('sign') : lang('signed')}}
                        </a>
                    </li>
                </ul>
            @else
                <ul class="nav navbar-nav navbar-right" id="content">

                    <li>
                        <a style="background:none;" href="{{ URL::route('auth.login') }}">
                            <i class="fa fa-user"></i>
                            {{ lang('Login') }}
                        </a>
                    </li>
                    <li>
                        <a style="background:none;" href="{{ URL::route('auth.register') }}" id="reg">
                            <i class="fa fa-user-plus"></i>
                            {{ lang('Register') }}
                        </a>
                    </li>

                </ul>
            @endif
        </nav>
    </div>
</header>


<script>
    function toggle_search(num) {


        if (num == 1) {
            $('#search_content').show()

            $('#content').hide()
            $('.search_input').animate({width: '200px'}, 300, function () {

            });
            $('.fa-search').hide();
            $('.fa-close').show();
        } else if (num == 2) {
            $('.search_input').animate({width: '0px'}, 300, function () {

            });
            $('#search_content').hide()

            $('#content').show()
            $('.fa-search').show();
            $('.fa-close').hide();
        }
    }


</script>
